package com.sc.nft.task;

import com.sc.nft.dao.DigitalCollectionProductInfoDao;
import com.sc.nft.entity.DigitalCollectionProductInfo;
import com.sc.nft.service.ProductStockService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@RequiredArgsConstructor
@Slf4j
public class CollectionStockBack {
    private final ProductStockService productStockService;
    private final DigitalCollectionProductInfoDao digitalCollectionProductInfoDao;

    @XxlJob("collectionStockBack")
    public void collectionStockBack()  {
        List<DigitalCollectionProductInfo> list=digitalCollectionProductInfoDao.getAllNeedBackStock();
        for (DigitalCollectionProductInfo digitalCollectionProductInfo : list) {
            productStockService.collectionStockBack(digitalCollectionProductInfo);
        }
    }

}
